﻿<?php
session_start();
echo '<body bgcolor="#009900"><center><h2>下载文件</h2>';
if(isset($_SESSION["user"])==false){
	header("location:../login.php");
	exit;
}
$user=$_SESSION["user"];
if(isset($_SESSION["dir"])==false){
	header("location:index.php");
	exit;
}
$dir=$_SESSION["dir"];
$name=$_POST["name"];

$file=fopen("../log.txt","a");
include '../lib/time.php';
fwrite($file,"\r\n" . $time . ":'$user' in '$dir' download file about '$name'.");


echo '<a href="index.php?dir=' . $dir . '">返回</a>';
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($user . "/" . $dir . "/" . $name));
readfile($user . "/" . $dir . "/" . $name);
exit;
?>